﻿<phone:PhoneApplicationPage 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 
    xmlns:krempel="clr-namespace:Krempel.WP7.Core.Controls;assembly=Krempel.WP7.Core"                        
    xmlns:GalaSoft_MvvmLight_Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP71" 
    xmlns:mycontrols="clr-namespace:AzureTracer.Views.Controls"   
    xmlns:myConvertes="clr-namespace:AzureTracer.Views.Converters"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:edc="clr-namespace:Microsoft.Expression.Controls;assembly=Microsoft.Expression.Drawing" 
    
    x:Class="AzureTracer.Views.DetailPage"
    mc:Ignorable="d"
    d:DesignWidth="480"
    d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    SupportedOrientations="Portrait"
    Orientation="Portrait"
    shell:SystemTray.IsVisible="True"
    DataContext="{Binding Detail, Source={StaticResource Locator}}">


    <phone:PhoneApplicationPage.Resources>
        <myConvertes:IntToLevelStringConverter x:Name="IntToLevelStringConverter"/>

        <ControlTemplate x:Key="PhoneDisabledTextBoxTemplate" TargetType="TextBox">
            <ContentControl 
                x:Name="ContentElement" 
                HorizontalContentAlignment="Stretch" 
                Margin="{StaticResource PhoneTextBoxInnerMargin}" 
                Padding="{TemplateBinding Padding}" 
                VerticalContentAlignment="Stretch"/>
        </ControlTemplate>
    </phone:PhoneApplicationPage.Resources>
    
    <!--Transitions-->
    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Forward>
                <krempel:ItemTurnstileTransition XMode="ForwardIn" YMode="BottomToTop" />
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut" />
            </toolkit:NavigationOutTransition.Backward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>


    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Image 
            Source="/Resources/Images/CloudClear.png" 
            HorizontalAlignment="Right" VerticalAlignment="Top" 
            Margin="0,40,380,0" 
            Height="64" Width="88"/>
        
        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel"
                    Grid.Row="0"
                    Margin="12,17,12,28">
            <TextBlock x:Name="Instand"
                       Text="{Binding Log.RoleInstance}"
                       Style="{StaticResource PhoneTextNormalStyle}" HorizontalAlignment="Left" />
            <TextBlock x:Name="Rol"
                       Text="{Binding Log.Role}"
                       Margin="25,-7,0,0"
                       krempel:ItemTurnstileTransition.IsTurnstileItem="True"
                       krempel:ItemTurnstileTransition.ItemContinuumMode="ForwardInBackwardOut"
                       Style="{StaticResource PhoneTextTitle1Style}" FontSize="48" Foreground="{StaticResource PhoneAccentBrush}" FontFamily="Segoe WP Semibold" />
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <TextBlock 
                    x:Name="Date" 
                    Text="{Binding Log.CultureTimestamp}" 
                    VerticalAlignment="Center" 
                    Padding="0,0,10,0" Margin="10,0"/>
                <StackPanel Grid.Column="1" Orientation="Horizontal" d:LayoutOverrides="Height">
                    <TextBlock Text="level"/>
                    <TextBlock 
                        Padding="5,0"
                        Text="{Binding Log.Level, Converter={StaticResource IntToLevelStringConverter}}" />
                </StackPanel>
            </Grid>
        </StackPanel>

        <ScrollViewer 
            x:Name="MessagePanel" 
            Grid.Row="1" 
            Background="{StaticResource PhoneChromeBrush}">
            <TextBox 
                x:Name="Message" 
                TextWrapping="Wrap" 
                IsReadOnly="True" 
                Template="{StaticResource PhoneDisabledTextBoxTemplate}"
        		Text="{Binding Log.Message}" 
                FontFamily="Segoe WP SemiLight" FontSize="29.333" 
                Margin="20,10,20,5" />
        </ScrollViewer>        

        <mycontrols:BindableApplicationBar x:Name="AppBar">
            <mycontrols:BindableApplicationBarIconButton 
                Command="{Binding SendEmailCommand}" 
                IconUri="/Resources/Images/appbar.feature.email.rest.png" 
                Text="{Binding Labels.SendMail, Source={StaticResource LabelsManager}}"/>
            <mycontrols:BindableApplicationBarIconButton 
                Command="{Binding DeleteCommand}"
                IconUri="/Resources/Images/ApplicationBar.Delete.png" 
                Text="{Binding Labels.Delete, Source={StaticResource LabelsManager}}"/>
            <mycontrols:BindableApplicationBar.MenuItems>
                <mycontrols:BindableApplicationBarMenuItem 
                    Command="{Binding SetAsUnreadCommand}" 
                    Text="{Binding Labels.AsUnread, Source={StaticResource LabelsManager}}"/>
            </mycontrols:BindableApplicationBar.MenuItems>
        </mycontrols:BindableApplicationBar>
    </Grid>

    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Loaded">
            <GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding LoadedCommand}"/>
        </i:EventTrigger>
    </i:Interaction.Triggers>

</phone:PhoneApplicationPage>